#!/usr/bin/perl -w
if( $#ARGV != 0 )#传给脚本的命令行参数列表
{
print $#ARGV;	
print "please give *.tar.gz","\n";
        exit;
}
`tar xzvf $ARGV[0]`;
my $md5info=`md5sum ./update.tar.gz |cut -d ' ' -f1`;#cut -d用来定义分隔符 -f表示需要取得哪个字段

my $certinfo=`openssl rsautl -verify  -in ssl.cer -pubin -inkey apub.pem`;

#-verify：对输入的数据进行验证,-pubin:公钥文件

if($md5info ne "" && $certinfo ne ""){
    if($md5info eq $certinfo){
	    print "It's OK!","\n";
	}else{
	    print "It's error!","\n";
	}
}
# if( $md5info ne "" ){
    # if($certinfo ne ""){
	    # if($md5info eq $certinfo)#ne不等于,eq等于
# {
	# print "It's OK!","\n";
# }else
# {
	# print "It's error!","\n";
# }
	# }
# }

`rm -rf ssl.cer`;
`rm -rf md5.txt`;
